# General info
SHELL       = @SHELL@
prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@
libdir      = @libdir@
datadir     = @datadir@
datarootdir = @datarootdir@
srcdir      = @srcdir@
VPATH       = $(srcdir)

# These may be overridden by make invocators
DESTDIR        =
GOSH           = "@GOSH@"
GAUCHE_CONFIG  = "@GAUCHE_CONFIG@"
GAUCHE_PACKAGE = "@GAUCHE_PACKAGE@"
INSTALL        = "@GAUCHE_INSTALL@" -C

# Other parameters
SOEXT  = @SOEXT@
OBJEXT = @OBJEXT@
EXEEXT = @EXEEXT@
LOCAL_PATHS = "@LOCAL_PATHS@"

# Module-specific stuff
PACKAGE   = cp2130

ARCHFILES = cp2130.$(SOEXT)
SCMFILES  = $(srcdir)/cp2130.scm
HEADERS   =

TARGET    = $(ARCHFILES)
GENERATED =
CONFIG_GENERATED = Makefile config.cache config.log config.status \
		   configure.lineno autom4te*.cache $(PACKAGE).gpd

GAUCHE_PKGINCDIR  = "$(DESTDIR)@GAUCHE_PKGINCDIR@"
GAUCHE_PKGLIBDIR  = "$(DESTDIR)@GAUCHE_PKGLIBDIR@"
GAUCHE_PKGARCHDIR = "$(DESTDIR)@GAUCHE_PKGARCHDIR@"

cp2130_SRCS = $(srcdir)/cp2130.c $(srcdir)/cp2130lib.stub

LIBS=@LIBS@


all : $(TARGET)

cp2130.$(SOEXT): $(cp2130_SRCS)
	$(GAUCHE_PACKAGE) compile \
	  --libs="../libcp2130.a $(LIBS)" \
	  --local=$(LOCAL_PATHS) --verbose cp2130 $(cp2130_SRCS)

check : all
	@rm -f test.log
	$(GOSH) -I. -I$(srcdir) $(srcdir)/test.scm > test.log

install : all
	$(INSTALL) -m 444 -T $(GAUCHE_PKGINCDIR) $(HEADERS)
	$(INSTALL) -m 444 -T $(GAUCHE_PKGLIBDIR) $(SCMFILES)
	$(INSTALL) -m 555 -T $(GAUCHE_PKGARCHDIR) $(ARCHFILES)
	$(INSTALL) -m 444 -T $(GAUCHE_PKGLIBDIR)/.packages $(PACKAGE).gpd

uninstall :
	$(INSTALL) -U $(GAUCHE_PKGINCDIR) $(HEADERS)
	$(INSTALL) -U $(GAUCHE_PKGLIBDIR) $(SCMFILES)
	$(INSTALL) -U $(GAUCHE_PKGARCHDIR) $(ARCHFILES)
	$(INSTALL) -U $(GAUCHE_PKGLIBDIR)/.packages $(PACKAGE).gpd

clean :
	$(GAUCHE_PACKAGE) compile --clean cp2130 $(cp2130_SRCS)
	rm -rf core $(TARGET) $(GENERATED) *~ test.log so_locations

distclean : clean
	rm -rf $(CONFIG_GENERATED)

maintainer-clean : clean
	rm -rf $(CONFIG_GENERATED)  VERSION
